package edu.gtcfla.km.repositories;

import java.io.Serializable;
import java.util.Collection;
import java.util.Map;
import java.util.Set;

import org.springframework.data.repository.Repository;

import edu.gtcfla.km.UserPermission;

public interface UserPermissionRepo<T extends UserPermission, ID extends Serializable> extends Repository<T, ID> {

	void save(T entity);
	
	void saveAll(Collection<T> entities);
	
	void update(T entity);
	
	void deleteFully(T entity);
	
	void updateAll(Collection<T> entities);	
	
	T findOne(ID primaryKey);
	
	void removeAllByCateUserIds(Set<String> cateIds , Set<String> allUserIds);
	
	Map<String, T> findUserPermissionForCategories(String userId);
	
	Map<String , T> findUserPermisionByUserIds(Set<String> userIds) ;
	
	/**
	 * get user permission for all categories, the run result is the type of map
	 * 
	 * 
	 * @param categoryId
	 * @param userIds
	 * @return the key is category id , and the value is user permission
	 */
	Map<String , T> findUserPermisionByCateAndUserIds(String categoryId , Set<String> userIds) ;	
}
